package com.example.roledepartment.controller;


import com.example.common.entity.Result;
import com.example.common.entity.sys.SysDept;
import com.example.common.entity.sys.SysRole;
import com.example.roledepartment.service.ISysDeptService;
import com.example.roledepartment.service.ISysRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 部门表 前端控制器
 * </p>
 *
 * @author cc
 * @since 2022-08-12
 */
@Api(tags = "部门信息管理")
@RestController
@RequestMapping("/sys-dept")
public class SysDeptController {

    @Autowired
    private ISysDeptService deptService;

    @ApiOperation("通过角色id查询部门信息")
    @GetMapping("/depts/{roleId}")
    public Result<List<SysDept>> getDeptsByRoleId(@PathVariable Long roleId) {
        return Result.ok(deptService.getDeptsByRoleId(roleId));
    }

}
